	$(document).ready(function()
	{
		$.mobile.ajaxEnabled=false;
	});
	
	$(document).ready(function()
			{
				$("#memberId").click(function()
				{
					 $('#info_memberId').html("");
				});
				$("#memberId").blur(function()
				{
					 
					var memberId =$('#memberId').val();
					
					 $.ajax({
					    	url:"getMemberByMemberId.action",
					 		type:'get',
					 		dataType:'json',
					 		data:{memberId:memberId},
					 		error:function(data)
					 		{
					 			alert("系统出现错误，请联系管理员。");
					 			
					 		},
					 		success:function(data)
					 		{
					
						          var result=data.result;  
						          $("#info_memberId").html("<font color='red'>"+result+"</font>");
						                 
						    }  
						 
						    });  
			});
	});

	$(document).ready(function() {
		$("#password").change(function(){
			$('#confirmPassword').val("");
			
		});
		
	});
		jQuery.validator.addMethod("isMobile", function(value, element) {
			var length = value.length;
			var mobile = /^(\+86)?(1[0-9]{10})$/;
			return this.optional(element) || (length == 11 && mobile.test(value));
		}, " 请正确填写您的手机号码 ");
		jQuery.validator.addMethod("isBirthday", function(value, element) {
			var birthday = /^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29))$/ ;
			return this.optional(element) || (birthday.test(value));
		}, " 请正确填写您的手机号码 ");
		$(document).ready(function() {
			$("#member_register_form").validate({
				
				rules : {
					memberId : 
					{
						required : true,
						rangelength:[3,15]
					},
					nickName : 
					{
						required : true
					},
					name : 
					{
						required : true
					},
					password :"required",
							
					confirmPassword : 
					{
						required : true,
						equalTo: "#password"
					},
					birthday :
					{
						required:true,
						isBirthday:true
					},
					address : 
					{
						required : true
					},
					email : 
					{
						required : true,
						email : true
					},
					mobilePhone : 
					{
						required : true,
						isMobile:true
					},
					qq : 
					{
						required : true,
						rangelength:[8,15]
					},
					hobbyIds : 
					{
						required : true
					}
				},
				messages : 
				{
					memberId : 
					{
						required : "请输入会员帐号",
						rangelength:"会员账号必须在3-15个数字之间(最好是您的手机号码)"
						//remote:"对不起，该会员账号已经被占用"
					},
					nickName : 
					{
						required : "请输入会员昵称"
					},
					name : 
					{
						required : "请输入会员姓名"
					},
					password :
					{
						required : "请输入密码"
					},
					confirmPassword : 
					{
						required : "请输入确认密码",
						equalTo : "两次输入的密码不一致，请重新输入！"
					},
					birthday : 
					{
						required : "请输入您的出生日期(YYYY-MM-DD)",
						isBirthday:"请正确填写您的出生日期(YYYY-MM-DD)"
					},
					address : 
					{
						required : "请输入地址"
					},
					mobilePhone : 
					{
						required : "请输入电话",
						isMobile: " 请正确填写您的手机号码"
					},
					email : 
					{
						required : "请输入邮箱地址",
						email : "输入的邮箱地址不正确"
					},
					qq : 
					{
						required : "请输入QQ账号",
						rangelength:"QQ账号必须在8-15个数字之间"
					},
					hobbyIds : 
					{
						required : "请选择爱好"
					}
					
				}
			});
		});

	$(document).ready(function()
    		{
    			$("#back").click(function()
    			{
    				location='list.action';
    			});
    		});
	
	

